package com.example.paopao.consumer.memer.controller;

import com.example.paopao.common.web.JsonResult;
import com.example.paopao.consumer.memer.pojo.dto.UserAlterInfoDTO;
import com.example.paopao.consumer.memer.service.IUserAlterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/v1/users/")
@Api("4.用户信息修改")
public class UserAlterController {

    @Autowired
    private IUserAlterService userAlterService;

    @PostMapping("alter")
    @ApiOperation("信息修改")
    @PreAuthorize("hasAuthority('/user/contact')")
    public JsonResult alterUser(@RequestBody UserAlterInfoDTO userAlterInfoDTO){
        System.out.println(userAlterInfoDTO);
        return JsonResult.ok(userAlterService.userAlterInfo(userAlterInfoDTO));
    }
}
